var express = require('express');
var router = express.Router();
var chainquery = require('../apple/query');
var chaininvoke = require('../apple/invoke');

/* GET apple_info page. */
router.get('/getAppleInfo', function(req, res, next) {
    var opt = [];
    opt[0] = "plant";
    opt[1] = "queryApple";
    opt[2] = req.query.id;
    console.log(opt);
    chainquery.query(opt, res);

});

/* GET transport_info page. */
router.get('/getTransportInfo', function(req, res, next) {
    var opt = [];
    opt[0] = "transport";
    opt[1] = "queryOrdersByApple";
    opt[2] = req.query.id;
    console.log(opt);
    chainquery.query(opt, res);

});

/* GET market_info page. */
router.get('/getSuppermarketInfo', function(req, res, next) {
    var opt = [];
    opt[0] = "market";

    // opt[1] = "changeAppleInfo";
    // opt[2] = req.query.id;
    // opt[3] = "30%";
    // opt[4] = "家乐福";
    // opt[5] = "-1";
    // opt[6] = "100";
    // opt[7] = "53";
    // console.log(opt);
    // chaininvoke.invoke(opt, res);

    opt[1] = "queryApple";
    opt[2] = req.query.id;
    console.log(opt);
    chainquery.query(opt, res);

});


module.exports = router;
